package com.hk.webapp.service.impl;

import com.hk.webapp.bean.SysRoleAction;
import com.hk.webapp.dao.SysRoleActionMapper;
import com.hk.webapp.service.SysRoleActionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class SysRoleActionServiceImpl implements SysRoleActionService {

    @Resource
    private SysRoleActionMapper sysRoleActionMapper;

    @Override
    public ArrayList<SysRoleAction> getEntityListByRoleId(Integer roleId) {
        return sysRoleActionMapper.getEntityListByRoleId(roleId);
    }

    @Override
    public List<SysRoleAction> getEntityListByRoleIds(List<Integer> roleIds) {
        return sysRoleActionMapper.getEntityListByRoleIds(roleIds);
    }

    @Override
    @Transactional
    public int deleteByRoleIds(List<Integer> ids) {
        return sysRoleActionMapper.deleteByRoleIds(ids);
    }

    @Override
    @Transactional
    public int insert(SysRoleAction sysRoleAction) {
        return sysRoleActionMapper.insertSelective(sysRoleAction);
    }
}
